package POJO;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "CUSTOMER")
public class Customer {
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "Customer_Id")
	private int customerId;
	
	@Column(name = "First_Name")
	private String firstName;
	
	@Column(name = "Last_Name")
	private String lastName;
	
	@Column(name = "Address")
	private String address;
	
	@Column(name = "Phone")
	private String phone;
	
	@Column(name = "Gender")
	private String gender;
	
	@Column(name = "Register_Date")
	private Date registerDate;
	
	@Column(name = "Expiration")
	private Date expiration;
	
	@Column(name = "Min_Purchase")
	private double minPurchase;
	
	@Column(name = "Max_Purchase")
	private double maxPurchase;
	
	@Column(name = "Deleted")
	private int deleted;
	
	@Column(name = "Email")
	private String email;
	
	@ManyToOne()
	@JoinColumn(name = "Customer_Type_Id")
	private CustomerType customerType;
	
	@OneToMany(mappedBy="customer")
	private Set<Bill> bills;

	@OneToMany(mappedBy="customer")
	private Set<Cart> carts;
	
	@OneToOne()
	@JoinColumn(name = "User_Name")
	private User user;

	public Customer() {
		super();
	}

	public Customer(String firstName, String lasrName, CustomerType customerType) {
		super();
		this.firstName = firstName;
		this.lastName = lasrName;
		this.customerType = customerType;
		
		this.registerDate = new Date();
		this.deleted = 0;
	}

	public Customer(String firstName, String lasrName,
			CustomerType customerType, User user) {
		super();
		this.firstName = firstName;
		this.lastName = lasrName;
		this.customerType = customerType;
		this.user = user;
		
		this.registerDate = new Date();
		this.deleted = 0;
	}

	public Customer(String firstName, String lasrName, String address,
			String phone, String gender, String email,
			CustomerType customerType, User user) {
		super();
		this.firstName = firstName;
		this.lastName = lasrName;
		this.address = address;
		this.phone = phone;
		this.gender = gender;
		this.email = email;
		this.customerType = customerType;
		this.user = user;
		
		this.registerDate = new Date();
		this.deleted = 0;
	}

	public int getCustomerId() {
		return customerId;
	}

	public void setCustomerId(int customerId) {
		this.customerId = customerId;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public Date getRegisterDate() {
		return registerDate;
	}

	public void setRegisterDate(Date registerDate) {
		this.registerDate = registerDate;
	}

	public Date getExpiration() {
		return expiration;
	}

	public void setExpiration(Date expiration) {
		this.expiration = expiration;
	}

	public double getMinPurchase() {
		return minPurchase;
	}

	public void setMinPurchase(double minPurchase) {
		this.minPurchase = minPurchase;
	}

	public double getMaxPurchase() {
		return maxPurchase;
	}

	public void setMaxPurchase(double maxPurchase) {
		this.maxPurchase = maxPurchase;
	}

	public int getDeleted() {
		return deleted;
	}

	public void setDeleted(int deleted) {
		this.deleted = deleted;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public CustomerType getCustomerType() {
		return customerType;
	}

	public void setCustomerType(CustomerType customerType) {
		this.customerType = customerType;
	}

	public Set<Bill> getBills() {
		return bills;
	}

	public void setBills(Set<Bill> bills) {
		this.bills = bills;
	}

	public Set<Cart> getCarts() {
		return carts;
	}

	public void setCarts(Set<Cart> carts) {
		this.carts = carts;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
}












